<template>
  <div>
    <div class="nav">
      <div class="nav-logo">
        <img src="~@/assets/img/wq.png" alt="" style="cursor: pointer;" @click="$router.replace({ path: '/' })">
      </div>
      <el-menu :default-active="activeIndex" class="nav-modules" mode="horizontal" @select="handleSelect">
        <el-menu-item
          v-for="item, index in HeaderNav"
          :key="index"
          class="nav-modules-item" 
          :index="item.index"
        >{{item.label}}</el-menu-item>
      </el-menu>
    </div>
  </div>
</template>

<script>
export default {
  components: {

  },
  data() {
    return {
      activeIndex: '1',
      HeaderNav: [
        {index: '0', label: '首页', name: 'Home'},
        {index: '1', label: '组件', name: 'Installation'},
      ],
    }
  },
  props: {
    activeNav: {
      type: String,
      default: '1'
    }
  },
  computed: {

  },
  created() {
    this.activeIndex = this.activeNav
  },
  methods: {
    handleSelect(val) {
      this.$router.push({name: this.HeaderNav[val].name})
    }
  }
}
</script>

<style scoped lang="scss">
  .nav {
    width: 1140px;
    margin: auto;
    display: flex;
    justify-content: space-between;

    &-logo {
      width: 100px;
      height: 80px;
      text-align: center;
      line-height: 80px;

      img {
        width: 60px;
        height: 60px;
      }
    }

    &-modules {
      width: 50%;
      height: 80px;
      display: flex;
      justify-content: flex-end;

      &-item {
        height: 79px;
        line-height: 79px;
        font-size: 16px;
      }
    }
  }
</style>
